/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.smn.jsf;

import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
import java.io.Serializable;
import org.primefaces.component.menuitem.MenuItem;
import org.primefaces.component.submenu.Submenu;
import org.primefaces.model.DefaultMenuModel;
import org.primefaces.model.MenuModel;

/**
 *
 * @author AdMus
 */
@Named(value = "menuBean")
@SessionScoped
public class MenuBean implements Serializable {

    /** Creates a new instance of MenuBean */
   
  
    private MenuModel model;  
  
    public MenuBean() {
        model = new DefaultMenuModel();  
          
        //First submenu  
        Submenu submenu = new Submenu();  
        submenu.setLabel("What are you going to do?");  
          
        MenuItem item = new MenuItem();  
        item.setValue("Share something");  
        item.setUrl("ShareWindow.xhtml");  
        submenu.getChildren().add(item);  
          
        model.addSubmenu(submenu);  
          
        //Second submenu  
//        submenu = new Submenu();  
//        submenu.setLabel("Dynamic Submenu 2");  
          
        item = new MenuItem();  
        item.setValue("View my shares");  
        item.setUrl("myShares.xhtml");  
        submenu.getChildren().add(item);  
          
        item = new MenuItem();  
        item.setValue("What I got shared");  
        item.setUrl("GotShared.xhtml");  
        submenu.getChildren().add(item);  
          
        model.addSubmenu(submenu);  
    }  
      
    public MenuModel getModel() {  
        return model;  
    }     
}  



